Check data

This is an R Markdown document that checks data that has passed initial delivery QC and is now in the test phase.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

Load library and data

Check fields

Uses check_fields() function to control if all required fields are present.

check_Chlorophyll(myfile)
## All required fields present
## # A tibble: 0 x 0

Overview of data

## Rows: 10
## Columns: 70
## $ delivery_datatype                  <fct> Chlorophyll, Chlorophyll, Chloro...
## $ check_status_sv                    <fct> Klar, Klar, Klar, Klar, Klar, Kl...
## $ data_checked_by_sv                 <fct> Leverantör, Leverantör, Leverant...
## $ visit_year                         <int> 2007, 2007, 2007, 2007, 2007, 20...
## $ station_name                       <fct> K382, K390 / U, K336 / G, K390 /...
## $ reported_station_name              <fct> K382, K390, K336, K390, K333, K3...
## $ sample_location_id                 <int> NA, 159417, 159416, 159417, 1594...
## $ station_id                         <int> NA, 188696, 188695, 188696, 1886...
## $ sample_project_name_sv             <fct> Coordinated recipient monitoring...
## $ sample_orderer_name_sv             <fct> Ljusnan-Voxnan Coalition of Wate...
## $ platform_code                      <int> 7798, 7798, 7798, 7798, 7798, 77...
## $ visit_id                           <int> 6011, 6012, 6008, 6018, 6013, 60...
## $ expedition_id                      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ shark_sample_id_md5                <fct> 0100b4fc85c96cf3f7f4bbb2deec1b24...
## $ sample_date                        <date> 2007-07-10, 2007-07-10, 2007-07...
## $ sample_time                        <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_enddate                     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_endtime                     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_latitude_dm                 <fct> 61 11.09, 61 12.27, 61 16.65, 61...
## $ sample_longitude_dm                <fct> 17 11.52, 17 09.17, 17 09.97, 17...
## $ sample_latitude_dd                 <dbl> 61.18483, 61.20450, 61.27750, 61...
## $ sample_longitude_dd                <dbl> 17.19200, 17.15283, 17.16617, 17...
## $ positioning_system_code            <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ water_depth_m                      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wind_direction_code                <int> 18, 22, 12, 13, 14, 12, 13, 13, ...
## $ wind_speed_ms                      <int> 2, 2, 6, 4, 5, 3, 3, 2, 7, 6
## $ air_temperature_degc               <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ air_pressure_hpa                   <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ weather_observation_code           <int> 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
## $ cloud_observation_code             <int> 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
## $ wave_observation_code              <int> 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
## $ ice_observation_code               <int> 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
## $ secchi_depth_m                     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ secchi_depth_quality_flag          <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ visit_comment                      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_id                          <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_min_depth_m                 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
## $ sample_max_depth_m                 <int> 10, 10, 6, 10, 4, 2, 6, 2, 10, 4
## $ sampling_laboratory_name_sv        <fct> Alcontrol laboratories, Alcontro...
## $ sampling_laboratory_accreditated   <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sampler_type_code                  <fct> HOS, HOS, HOS, HOS, HOS, HOS, HO...
## $ sampled_volume_l                   <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ sample_comment                     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ parameter                          <fct> Chlorophyll-a, Chlorophyll-a, Ch...
## $ value                              <dbl> 3.3, 3.1, 5.0, 2.0, 1.8, 6.0, 5....
## $ unit                               <fct> ug/l, ug/l, ug/l, ug/l, ug/l, ug...
## $ quality_flag                       <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ calc_by_dc                         <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ analysis_method_code               <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ method_documentation               <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ method_reference_code              <fct> SS 028146-1 mod, SS 028146-1 mod...
## $ variable_comment                   <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ estimation_uncertainty             <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ method_calculation_uncertainty     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ quantification_limit               <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ detection_limit                    <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ analysis_range                     <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ analytical_laboratory_name_sv      <fct> Alcontrol laboratories, Alcontro...
## $ analytical_laboratory_accreditated <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ analysis_date                      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ station_viss_eu_id                 <fct> NA, SE678840-157245, SE679655-15...
## $ water_land_station_type_code       <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ monitoring_station_type_code       <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ monitoring_purpose_code            <lgl> NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ monitoring_program_code            <fct> REG, REG, REG, REG, REG, REG, RE...
## $ reporting_institute_name_sv        <fct> Swedish Meteorological and Hydro...
## $ data_holding_centre                <fct> Swedish Meteorological and Hydro...
## $ internet_access                    <fct> "http://sharkweb.smhi.se, http:/...
## $ dataset_name                       <fct> SHARK_Chlorophyll_2007_SMHI_LVVF...
## $ dataset_file_name                  <fct> SHARK_Chlorophyll_2007_SMHI_LVVF...

Check map

Uses plot_map_leaflet to render an interactive leaflet map of sampled stations in the data.

Check onland

Uses check_onland() to control if any locations are on land.

# check_onland(myfile)

Check depth

Uses check_depth() to control if any sample depths are incorrect.

# check_depth(myfile)

Check outliers

Uses check_outliers() function to control if all values are within range.

check_chlorophyll_conc(myfile)

Check logical

Uses check_logical() function to control if data follows logical assumptions.

check_value_logical(myfile)
## Expected numerical value is formatted as numerical and no character values were found

Check codes

Uses check_codes() function to control if data follows the SMHI codelist.

check_code_proj(myfile)
## 
## -- Column specification --------------------------------------------------------
## cols(
##   Data_field = col_character(),
##   Code = col_character(),
##   `Beskrivning/Svensk översättning` = col_character(),
##   `Description/English translate` = col_character()
## )
## All project (PROJ) codes found

Reproducibility

# Date time
Sys.time()
## [1] "2020-11-11 21:25:11 EET"
# Here we store the session info for this script
sessioninfo::session_info()
## - Session info ---------------------------------------------------------------
##  setting  value                       
##  version  R version 4.0.3 (2020-10-10)
##  os       Windows 10 x64              
##  system   x86_64, mingw32             
##  ui       RTerm                       
##  language (EN)                        
##  collate  Swedish_Sweden.1252         
##  ctype    Swedish_Sweden.1252         
##  tz       Europe/Helsinki             
##  date     2020-11-11                  
## 
## - Packages -------------------------------------------------------------------
##  package           * version date       lib source                            
##  assertthat          0.2.1   2019-03-21 [1] CRAN (R 4.0.3)                    
##  backports           1.2.0   2020-11-02 [1] CRAN (R 4.0.3)                    
##  broom               0.7.2   2020-10-20 [1] CRAN (R 4.0.3)                    
##  cellranger          1.1.0   2016-07-27 [1] CRAN (R 4.0.3)                    
##  cli                 2.1.0   2020-10-12 [1] CRAN (R 4.0.3)                    
##  colorspace          2.0-0   2020-11-11 [1] CRAN (R 4.0.3)                    
##  crayon              1.3.4   2017-09-16 [1] CRAN (R 4.0.3)                    
##  crosstalk           1.1.0.1 2020-03-13 [1] CRAN (R 4.0.3)                    
##  data.table          1.13.2  2020-10-19 [1] CRAN (R 4.0.3)                    
##  DBI                 1.1.0   2019-12-15 [1] CRAN (R 4.0.3)                    
##  dbplyr              2.0.0   2020-11-03 [1] CRAN (R 4.0.3)                    
##  digest              0.6.27  2020-10-24 [1] CRAN (R 4.0.3)                    
##  dplyr             * 1.0.2   2020-08-18 [1] CRAN (R 4.0.3)                    
##  DT                * 0.16    2020-10-13 [1] CRAN (R 4.0.3)                    
##  ellipsis            0.3.1   2020-05-15 [1] CRAN (R 4.0.3)                    
##  evaluate            0.14    2019-05-28 [1] CRAN (R 4.0.3)                    
##  fansi               0.4.1   2020-01-08 [1] CRAN (R 4.0.3)                    
##  forcats           * 0.5.0   2020-03-01 [1] CRAN (R 4.0.3)                    
##  fs                  1.5.0   2020-07-31 [1] CRAN (R 4.0.3)                    
##  generics            0.1.0   2020-10-31 [1] CRAN (R 4.0.3)                    
##  ggplot2           * 3.3.2   2020-06-19 [1] CRAN (R 4.0.3)                    
##  glue                1.4.2   2020-08-27 [1] CRAN (R 4.0.3)                    
##  gtable              0.3.0   2019-03-25 [1] CRAN (R 4.0.3)                    
##  haven               2.3.1   2020-06-01 [1] CRAN (R 4.0.3)                    
##  hms                 0.5.3   2020-01-08 [1] CRAN (R 4.0.3)                    
##  htmltools           0.5.0   2020-06-16 [1] CRAN (R 4.0.3)                    
##  htmlwidgets         1.5.2   2020-10-03 [1] CRAN (R 4.0.3)                    
##  httr              * 1.4.2   2020-07-20 [1] CRAN (R 4.0.3)                    
##  jsonlite            1.7.1   2020-09-07 [1] CRAN (R 4.0.3)                    
##  knitr             * 1.30    2020-09-22 [1] CRAN (R 4.0.3)                    
##  labeling            0.4.2   2020-10-20 [1] CRAN (R 4.0.3)                    
##  lazyeval            0.2.2   2019-03-15 [1] CRAN (R 4.0.3)                    
##  leaflet           * 2.0.3   2019-11-16 [1] CRAN (R 4.0.3)                    
##  leaflet.providers   1.9.0   2019-11-09 [1] CRAN (R 4.0.3)                    
##  lifecycle           0.2.0   2020-03-06 [1] CRAN (R 4.0.3)                    
##  lubridate         * 1.7.9   2020-06-08 [1] CRAN (R 4.0.3)                    
##  magrittr            1.5     2014-11-22 [1] CRAN (R 4.0.3)                    
##  modelr              0.1.8   2020-05-19 [1] CRAN (R 4.0.3)                    
##  munsell             0.5.0   2018-06-12 [1] CRAN (R 4.0.3)                    
##  pillar              1.4.6   2020-07-10 [1] CRAN (R 4.0.3)                    
##  pkgconfig           2.0.3   2019-09-22 [1] CRAN (R 4.0.3)                    
##  plotly            * 4.9.2.1 2020-04-04 [1] CRAN (R 4.0.3)                    
##  purrr             * 0.3.4   2020-04-17 [1] CRAN (R 4.0.3)                    
##  R6                  2.5.0   2020-10-28 [1] CRAN (R 4.0.3)                    
##  rappdirs            0.3.1   2016-03-28 [1] CRAN (R 4.0.3)                    
##  Rcpp                1.0.5   2020-07-06 [1] CRAN (R 4.0.3)                    
##  readr             * 1.4.0   2020-10-05 [1] CRAN (R 4.0.3)                    
##  readxl            * 1.3.1   2019-03-13 [1] CRAN (R 4.0.3)                    
##  reprex              0.3.0   2019-05-16 [1] CRAN (R 4.0.3)                    
##  rlang               0.4.8   2020-10-08 [1] CRAN (R 4.0.3)                    
##  rmarkdown           2.5     2020-10-21 [1] CRAN (R 4.0.3)                    
##  rstudioapi          0.12    2020-11-10 [1] CRAN (R 4.0.3)                    
##  rvest               0.3.6   2020-07-25 [1] CRAN (R 4.0.3)                    
##  scales              1.1.1   2020-05-11 [1] CRAN (R 4.0.3)                    
##  sessioninfo         1.1.1   2018-11-05 [1] CRAN (R 4.0.3)                    
##  SHARK4R           * 0.0.1   2020-11-11 [1] Github (sharksmhi/SHARK4R@68a0e0f)
##  stringi             1.5.3   2020-09-09 [1] CRAN (R 4.0.3)                    
##  stringr           * 1.4.0   2019-02-10 [1] CRAN (R 4.0.3)                    
##  tibble            * 3.0.4   2020-10-12 [1] CRAN (R 4.0.3)                    
##  tidyr             * 1.1.2   2020-08-27 [1] CRAN (R 4.0.3)                    
##  tidyselect          1.1.0   2020-05-11 [1] CRAN (R 4.0.3)                    
##  tidyverse         * 1.3.0   2019-11-21 [1] CRAN (R 4.0.3)                    
##  utf8                1.1.4   2018-05-24 [1] CRAN (R 4.0.3)                    
##  vctrs               0.3.4   2020-08-29 [1] CRAN (R 4.0.3)                    
##  viridisLite         0.3.0   2018-02-01 [1] CRAN (R 4.0.3)                    
##  withr               2.3.0   2020-09-22 [1] CRAN (R 4.0.3)                    
##  worrms            * 0.4.2   2020-07-08 [1] CRAN (R 4.0.3)                    
##  xfun                0.19    2020-10-30 [1] CRAN (R 4.0.3)                    
##  xml2                1.3.2   2020-04-23 [1] CRAN (R 4.0.3)                    
##  yaml                2.2.1   2020-02-01 [1] CRAN (R 4.0.3)                    
## 
## [1] C:/__R/R-4.0.3/library

Runtime of script

## Time difference of 5.114347 secs